package com.yaodian100.ec.payment.remote;

import org.springframework.beans.factory.annotation.Autowired;

import com.yaodian100.core.common.exception.CoreException;
import com.yaodian100.ec.payment.entity.ApplyCashOut;
import com.yaodian100.ec.payment.entity.BankTransfer;
import com.yaodian100.ec.payment.service.ThirdpartyPaymentService;
import com.yaodian100.ec.payment.service.TransferService;

public class RemoteTransferServiceImpl implements RemoteTransferService {
	@Autowired
	private TransferService transferService;
	@Autowired
	private ThirdpartyPaymentService thirdpartyPaymentService;

	public String bathChargeByBankTransfer(String date) throws CoreException {
		try {
			transferService.bathChargeByBankTransfer();
		} catch (Exception e) {
			return e.getMessage();
		}
		return "true";
	}

	public String updateApplyCashOutStatus(ApplyCashOut applyCashOut) throws CoreException {
		try {
			transferService.updateApplyCashOut(applyCashOut);
		} catch (Exception e) {
			return e.getMessage();
		}
		return "true";
	}

	public String batchInsertBankTransfer(BankTransfer bankTransfer) throws CoreException {
		try {
			bankTransfer.setStatus("10");

			transferService.saveBankTransfer(bankTransfer);
		} catch (Exception e) {
			return e.getMessage();
		}
		return "true";
	}

	public String retry3rdPartyFail(String date) {
		thirdpartyPaymentService.retry3rdPartyFail();
		return "true";
	}

	public String creditcardNotify(String orderId, String tid) {
		return thirdpartyPaymentService.invaildCreditCardNotify(orderId, tid);

	}

}